﻿@using EmoneyWeiXinEntity;
@using EmoneyWeiXinCommon
@{
    Layout = null;
    weixinUserEntity wxInfo = ViewBag.wxInfo as weixinUserEntity; 
}

<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <title>收货地址填写</title>
    <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport">
    <meta name="format-detection" content="telephone=no" />
    <meta name="format-detection" content="email=no" />
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="apple-mobile-web-app-status-bar-style" content="black" />
    <script type="text/javascript">
        (function (doc, win) {
            var docEl = doc.documentElement,
                resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize',
                recalc = function () {
                    var clientWidth = docEl.clientWidth < 768 ? docEl.clientWidth : 768;
                    if (!clientWidth) return; docEl.style.fontSize = 16 * (clientWidth / 320) + 'px';
                }; recalc();
            if (!doc.addEventListener) return; win.addEventListener(resizeEvt, recalc, false);
        })(document, window);
    </script>
    <link href="@Url.Content("~/css/NineMonth/basic.css")?a=@(new Random().Next())" rel="stylesheet" />
    <script src="@Url.Content("~/js/jquery.js")"></script>
    <script src="@Url.Content("~/js/jweixin-1.0.0.js")"></script>
    <script src="@Url.Content("~/js/WeiXinCommon2.js")?a=@(new Random().Next())"></script>
    <script type="text/javascript">

        (function ($) {
            var openid = '@ViewBag.openid';
            $(function () {
                initEvent();
            });


            function initEvent() {
                $("#isGuMinYes").click(function () {
                    if ($(this).prop("checked")) {
                        $("#isGuMinNo").prop("checked", false);
                    }
                });
                $("#isGuMinNo").click(function () {
                    if ($(this).prop("checked")) {
                        $("#isGuMinYes").prop("checked", false);
                    }
                });

                $("#btnSubmit").click(function () {
                    if (confirm("信息填写之后不能再修改，请确认是否填写正确！")) {
                        if (yanzheng()) {
                            $.ajax({
                                url: '@Url.Action("ReceiptAddressInfo", "NineMonthActive")',
                                data: { openid: openid, name: $("#txtName").val(), phone: $("#txtPhone").val(), address: $("#txtAdrress").val(), isGumin: $("#isGuMinYes").prop("checked") ? "1" : "0" },
                                type: 'post',
                                success: function (data) {
                                    if (data == "1") {
                                        alert("添加成功！");
                                    } else if (data == "2") {
                                        alert("你已经进行过提交了！");
                                    }
                                    else {
                                        alert("添加失败！");
                                    }
                                }
                            });
                        }
                    }
                });

            }

            function yanzheng() {
                if ($.trim($("#txtName").val()) == "") {
                    alert("请填写姓名！");
                    return false;
                }

                if ($.trim($("#txtPhone").val()) == "") {
                    alert("请填写电话！");
                    return false;
                }
                var regPhone = /^1\d{10}$/;
                if (!regPhone.test($.trim($("#txtPhone").val()))) {
                    alert("请填写正确的手机号？");
                    return false;
                }
                if ($.trim($("#txtAdrress").val()) == "") {
                    alert("请填写地址！");
                    return false;
                }
                if (!($("#isGuMinYes").prop("checked")) && !($("#isGuMinNo").prop("checked"))) {
                    alert("请填写是否是股民");
                    return false;
                }
                return true;
            }
        })(jQuery);

        //当执行分享动作的时候执行
        function sharaEvent(type) {

            $.ajax({
                url: '@Url.Action("ShareAct", "NineMonthActive")',
                type: 'post',
                data: { openid: '@ViewBag.openid', sharaType: type },
                success: function (data) {
                }
            });
        }
    </script>
</head>
<body onload="rize()" onresize="rize()">
    <div class="box_A">
        <p class="box_A_bg" style="background:url(@Url.Content("~/images/NineMonth/bg01.png"))  no-repeat center">
        </p>
        <div class="content02">
            <div class="prize_06">
                <p>
                    <img src="@Url.Content("~/images/NineMonth/prize06.png")" />
                </p>
                <input type="text" class="prize_input1" id="txtName">
                <input type="text" class="prize_input2" id="txtPhone">
                <input type="text" class="prize_input3" id="txtAdrress">
                <input type="checkbox" class="prize_input4" id="isGuMinYes">
                <input type="checkbox" class="prize_input5" id="isGuMinNo">
                <a href="#" id="btnSubmit"></a>
            </div>
        </div>
    </div>
</body>
<script>
    function rize() {
        var height = document.documentElement.clientHeight;
        $("body").css({ "height": height });
        $(".box_A").css({ "height": height });
    }
</script>



</html>
@*  关于微信分享部分的代码*@
<script type="text/javascript">
    var AppId = "@wxInfo.AppId";
    var AppSercret = "@wxInfo.AppSecret";
    var shareUrl = "@System.Configuration.ConfigurationManager.AppSettings["jyhdwzUrl"]";
    var timestamp = "@ViewBag.timestamp";
    var imgUrl = "@Config.Host_Url3" + "images/NineMonth/" + "shareImg.png";
    var tTitle = "看哭了，童年的记忆，每张图都戳中泪点";
    var tContent = "好棒的文章，深度戳泪，回忆泛滥。还能玩转盘，赢得大礼。快来跟我一起回忆吧！";
    var nonceStr = "@ViewBag.nonceStr";
    var signature = "@ViewBag.signature";
    ///初始化分享到朋友圈的功能
    function initSharePara() {
        mysharetime(shareUrl, imgUrl, tTitle, tContent, AppId, timestamp, nonceStr, signature, sharaEvent);
    }
    initSharePara();

</script>
